<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ui" uri="http://com.am.tag" %>
<%@ include file="../common.jsp"%>
<%@ page import="com.system.dao.DictionaryDao"%>
<%
	DictionaryDao dao = new DictionaryDao();
	Map<String,Object> map = dao.getMessage();
	pageContext.setAttribute("map", map);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'userList.jsp' starting page</title>
    <script type="text/javascript">
	   
    	/* $().ready(function(){
    	alert("");
    		ajax.remoteCall("com.system.dao.DictionaryDao:getMessage","",function(reply){
				result = reply.getResult();
				
				 $("#operater1").val(result.operater1);
				$("#operater2").val(result.operater2);
				$("#operater1Num").val(result.operater1Num);
				$("#operater2Num").val(result.operater2Num); 
    	}); */
    	
    	$().ready(function(){
    		$("#date1").val("${map['date1']}");
    		$("#date2").val("${map['date2']}");
    		$("#date3").val("${map['date3']}");
    		$("#date4").val("${map['date4']}");
    	});
    	
    	
    	function doCheck()
    	{
    		if($.trim($("#operater1").val()) == "" || $.trim($("#operater1Num").val()) == "" || $.trim($("#operater2").val()) == "" || $.trim($("#operater2Num").val()) == "")
    		{
    			alert("管理员信息不能为空");
    			return false;
    		}
    		
    		if(($.trim($("#date1").val()) == "" || $.trim($("#date2").val()) == ""))
    		{
    			alert("请设置急诊时间段");
    			return false;
    		}else{
    			if(($("#date1").val()>"12:00:00") || ($("#date2").val()>"12:00:00")){
	    			alert("上午的时间段应该在12点之前");
	    			return false;
    			}else{
    				if(($("#date1").val()>$("#date2").val())){
		    			alert("时间段后面的时间应该比前面的时间大");
		    			return false;
		    		}
    				
    			}
    		}
    		
    		if(($.trim($("#date3").val()) == "" || $.trim($("#date4").val()) == ""))
    		{
    			alert("请设置急诊时间段");
    			return false;
    		}else{
    			if(($("#date3").val()<"12:00:00") || ($("#date4").val()<"12:00:00")){
	    			alert("下午的时间段应该在12点之后");
	    			return false;
    			}else{
    				if( ($("#date3").val()>$("#date4").val())){
		    			alert("时间段后面的时间应该比前面的时间大");
		    			return false;
    				}
    			}
    		}
    		
    		if($.trim($("#code").val()) != "" && !check_alpha($.trim($("#code").val())))
    		{
    			alert("数据项的编码需要是英文");
    			return false;
    		}
    		
    		return true;
    	}
    	
    	function doSave()
    	{	
    		if(doCheck())
    		{
    			var map = Form.formToBean("winForm");
        		ajax.remoteCall("com.system.dao.DictionaryDao:updateMessage",[map],function(reply){
        			var result = reply.getResult();
        			alert(result.value);
        			return false;
        		});
    		}
    	}
    	
    </script>
  </head>
  
  <body>
  	<center>	
		<table style="width: 100%;" cellSpacing="0" cellPadding="0" border="0">
  		<tr>
			<td class="windowTitle">系统管理  &gt; 信息编辑</td>
		</tr>
		</table>
		<form id="winForm" name="winForm">
			<fieldset style="width :75%; height: 20%; padding-left: 10px;" >
				<legend>管理员信息编辑</legend>
				<br/>
				<table cellSpacing="0" cellPadding="0" border="0">
					<tr>
						<td width="120" height="30" align="right"><font color="#FF0000">*</font>&nbsp;管理员1名称：</td>
						<td align="left">
							<input name="operater1" id="operater1" value="${map['operater1']}" class="textbox" style="width: 220px" />
						</td>
						<td width="120" height="30" align="right"><font color="#FF0000">*</font>&nbsp;管理员1电话：</td>
						<td align="left">
							<input name="operater1Num" id="operater1Num" class="textbox" value="${map['operater1Num']}" style="width: 220px"/>
						</td>
					</tr>
					<tr>
						<td width="120" height="30" align="right"><font color="#FF0000">*</font>&nbsp;管理员2名称：</td>
						<td align="left">
							<input name="operater2" id="operater2" value="${map['operater2']}" class="textbox" style="width: 220px" />
						</td>
						<td width="120" height="30" align="right"><font color="#FF0000">*</font>&nbsp;管理员2电话：</td>
						<td align="left">
							<input name="operater2Num" id="operater2Num" value="${map['operater2Num']}" class="textbox" style="width: 220px"/>
						</td>
					</tr>
				</table>
			</fieldset>	
		
		
			<fieldset style="width :75%; height: 20%; padding-left: 10px;padding-top: 40px;" >
				<legend>用户须知信息编辑</legend>
				<br/>
				<table cellSpacing="0" cellPadding="0" border="0" > 
					<tr >
						<td width="120" height="30" style="vertical-align:top;" align="right">
							医生职责：
						</td>
						<td align="left" style="padding-top:5px;" colspan="3">
							<textarea id="responsibility" name="responsibility" rows="6" cols="71" style="overflow-y:auto;border-color: #6699ca;">${map['responsibility']}</textarea>
						</td>
					</tr>
				</table>
			</fieldset>	
			
			<!-- <fieldset style="width :75%; height: 10%; padding-left: 10px;padding-top: 40px;" >
				<legend>急诊时间段设置</legend>
				<br/>
				<table cellSpacing="0" cellPadding="0" border="0" > 
					<tr >
						<td>
							上午：<ui:DateTimePicker name="date1" id="date1"  dateFormat="HH:mm:ss" style="width:145px"/>&gt;&gt;
							<ui:DateTimePicker name="date2" id="date2"  dateFormat="HH:mm:ss" style="width:145px" />
							<span style="width:30px"></span>下午：<ui:DateTimePicker name="date3" id="date3"  dateFormat="HH:mm:ss" style="width:145px" />&gt;&gt;
							<ui:DateTimePicker name="date4" id="date4"  dateFormat="HH:mm:ss" style="width:145px" />
						</td>
					</tr>
				</table>
			</fieldset>	 -->
			
			<fieldset style="width :75%; height: 20%; padding-left: 10px;padding-top: 40px;" >
				<legend>通知栏</legend>
				<br/>
				<table cellSpacing="0" cellPadding="0" border="0" > 
					<tr >
						<td width="120" height="30" style="vertical-align:top;" align="right">
							疫情通报：
						</td>
						<td align="left" style="padding-top:5px;" colspan="3">
							<textarea id="notice" name="notice" rows="5" cols="71" style="overflow-y:auto;border-color: #6699ca">${map['notice']}</textarea>
						</td>
					</tr>
				</table>
			</fieldset>	
		</form>
		
		<table style="width: 75%;" cellSpacing="0" cellPadding="0" border="0">
			<tr height="38">
					<td  align="right">
							<ui:Button id="save" type="save" onclick="javascript:doSave();">保存</ui:Button>
					</td>
			</tr>
		</table>
		
	</center>
  </body>
</html>